package com.cn.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cn.pojo.ShoppingCart;
import com.cn.response.Result;
import com.cn.service.ShoppingCartService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 功能描述: <br>
 *
 * @program: wx-nimi-bank
 * @description: 购物车控制层
 * @author: Mr.TYJ
 * @create: 2022-06-08 09:15
 **/
@RestController
@CrossOrigin
@Slf4j
@Api(tags = "菜品控制层")
@RequestMapping("/shopping")
public class ShoppingCartController {

    @Autowired
    private ShoppingCartService shoppingCart;

    @GetMapping("/getSelectAll")
    public Result getSelectAll(@RequestParam(value = "current",required = true,defaultValue = "1")Integer current,
                               @RequestParam(value = "size",required = true,defaultValue = "5")Integer size,
                               @RequestParam(value = "nickName",required = false)String nickName){
        Page<ShoppingCart> page=new Page<>(current,size);
        Page<ShoppingCart> pageList=shoppingCart.getSelectAll(page,nickName);
        return Result.ok().data("pageList",pageList);
    }
}
